Added option to xentrace to set the trace buffer size.
authorGeorge Dunlap <dunlapg@umich.edu>
Mon, 21 Aug 2006 16:05:11 +0000 (12:05 -0400)
committerGeorge Dunlap <dunlapg@umich.edu>
Mon, 21 Aug 2006 16:05:11 +0000 (12:05 -0400)
Signed-off-by: George Dunlap <gdunlap@xensource.com>
tools/xentrace/xentrace.c

index 17e76527d7258fb4feabe6b3ef8a6aababef3f92..64327a6836bff7f9600fcb2805a76006ca992a12 100644 (file)
@@ -55,6 +55,7 @@ typedef struct settings_st {
     unsigned long new_data_thresh;
     uint32_t evt_mask;
     uint32_t cpu_mask;
+    unsigned long tbuf_size;
 } settings_t;
 
 settings_t opts;
@@ -111,7 +112,10 @@ static void get_tbufs(unsigned long *mfn, unsigned long *size)
         exit(EXIT_FAILURE);
     }
 
-    ret = xc_tbuf_enable(xc_handle, DEFAULT_TBUF_SIZE, mfn, size);
+    if(!opts.tbuf_size)
+      opts.tbuf_size = DEFAULT_TBUF_SIZE;
+
+    ret = xc_tbuf_enable(xc_handle, opts.tbuf_size, mfn, size);
 
     if ( ret != 0 )
     {
@@ -400,6 +404,15 @@ error_t cmd_parser(int key, char *arg, struct argp_state *state)
     }
     break;
     
+    case 'S': /* set tbuf size (given in pages) */
+    {
+        char *inval;
+        setup->tbuf_size = strtol(arg, &inval, 0);
+        if ( inval == arg )
+            argp_usage(state);
+    }
+    break;
+
     case ARGP_KEY_ARG:
     {
         if ( state->arg_num == 0 )
@@ -439,6 +452,12 @@ const struct argp_option cmd_opts[] =
       .doc = 
       "set evt-mask " },
 
+    { .name = "trace-buf-size", .key='S', .arg="N",
+      .doc =
+      "Set trace buffer size in pages (default " xstr(DEFAULT_TBUF_SIZE) "). "
+      "N.B. that the trace buffer cannot be resized.  If it has "
+      "already been set this boot cycle, this argument will be ignored." },
+
     {0}
 };